<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j"
  xmlns:c="http://java.sun.com/jstl/core">

  <c:if test="#{widget.mode == 'edit'}">
    
    
    <h:selectOneRadio id="#{widget.id}_immediate_creation" name="#{widget.id}_immediate_creation"
                      value="#{userManagementActions.immediateCreation}">
        <f:selectItem itemLabel="#{messages['label.immediateCreation.no']}" itemValue="false" />
        <f:selectItem itemLabel="#{messages['label.immediateCreation.yes']}" itemValue="true" />
        <f:ajax event="change" render="#{widget.id}_immeditateCreationTip #{widget.id}_passwordPanel" id="#{widget.id}_ajax_pwd" execute="@this" />
    </h:selectOneRadio>
    
    <a4j:outputPanel id="#{widget.id}_immeditateCreationTip" layout="block">
      <h:outputText styleClass="detail" rendered="#{userManagementActions.immediateCreation}" value="#{messages['immediateCreation.yes.tip']}" ></h:outputText>
      <h:outputText styleClass="detail" rendered="#{!userManagementActions.immediateCreation}" value="#{messages['immediateCreation.no.tip']}" ></h:outputText>
    </a4j:outputPanel>    

    <a4j:outputPanel id="#{widget.id}_passwordPanel" layout="block">
      <c:if test="#{userManagementActions.immediateCreation}">
        <h:outputLabel for="#{widget.id}_firstPassword" value="#{messages['password']}" />
        <h:inputSecret id="#{widget.id}_firstPassword" styleClass="#{widgetProperty_styleClass}"
          required="#{widgetProperty_required}" value="#{field_0}">
        </h:inputSecret>
        <h:message for="#{widget.id}_firstPassword" styleClass="errorMessage" />
        
        <h:outputLabel for="#{widget.id}_secondPassword" value="#{messages['password.verify']}" />
        <h:inputSecret id="#{widget.id}_secondPassword" styleClass="#{widgetProperty_styleClass}"
          required="#{widgetProperty_required}">
        </h:inputSecret>
        <h:message for="#{widget.id}_secondPassword" styleClass="errorMessage" />

        <h:inputHidden value="needed" validator="#{userManagementActions.validatePassword}" id="#{widget.id}">
          <f:attribute name="firstPasswordInputId" value="#{widget.id}_firstPassword" />
          <f:attribute name="secondPasswordInputId" value="#{widget.id}_secondPassword" />
        </h:inputHidden>
        <h:message for="#{widget.id}" styleClass="errorMessage" />
      </c:if>
    </a4j:outputPanel>
  </c:if>

</ui:composition>